package com.yuzhihao.writejvm.format;

import com.yuzhihao.writejvm.attributes.runtimeva.ElementValue;

import java.util.Arrays;

/**
 * 元素值
 *
 * @author yzh
 * @since 2021年12月11日14:13:57
 */
public enum ElementValueEnum {
    //
    Byte('B',"byte","const_value_index","CONSTANT_Integer"),
    Char('C',"char","const_value_index","CONSTANT_Integer"),
    Double('D',"double","const_value_index","CONSTANT_Double"),
    Float('F',"float","const_value_index","CONSTANT_Float"),
    Int('I',"int","const_value_index","CONSTANT_Integer"),
    Long('J',"long","const_value_index","CONSTANT_Long"),
    Short('S',"short","const_value_index","CONSTANT_Integer"),
    Boolean('Z',"boolean","const_value_index","CONSTANT_Integer"),
    String('s',"string","const_value_index","CONSTANT_Utf8"),
    Enum('e',"Enum","enum_const_value",""),
    Class('c',"Class","class_info_index",""),
    Annotation('@',"Annotation","annotation_value",""),
    Array('[',"Array","array_value","")
    ;

    private final char tag;
    private final String type;
    private final String value;
    private final String constant;

    ElementValueEnum(char tag, String type, String value, String constant) {
        this.tag = tag;
        this.type = type;
        this.value = value;
        this.constant = constant;
    }

    public char getTag() {
        return tag;
    }

    public String getType() {
        return type;
    }

    public String getValue() {
        return value;
    }

    public String getConstant() {
        return constant;
    }
}
